package com.budwk.app.sqfwV2.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;

import java.util.Arrays;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum MeetingEnums {


    MEETING_MINUTES_DOCX(1,"会议记录", "meetingActivityRecord/meeting.docx",null,false),
    ACTIVITIES_DOCX(2,"活动记录", "meetingActivityRecord/activity.docx",null,false),
    VISITING_RECORDS_DOCX(3,"来访记录", "meetingActivityRecord/visiting.docx",null,false),

    MEETING_MINUTES_EXCEL(5,"会议记录_通用", "meetingActivityRecord/meeting.xlsx","/templet/visiting.docx",true),
    MEETING_MINUTES_DETAIL_EXCEL(4,"会议记录_详细", "meetingActivityRecord/meeting_detail.xlsx","/templet/visiting.docx",true),
    ACTIVITIES_EXCEL(6,"活动记录", "meetingActivityRecord/activity.xlsx","/templet/visiting.docx",true),
    VISITING_RECORDS_EXCEL(7,"来访记录", "meetingActivityRecord/visit.xlsx","/templet/visiting.docx",true),
    DOCX_SUMMARY(8,"详细工作记录汇总", "visiting.docx","/templet/visiting.docx",true);


    private  int code;
    private  String name;
    private  String templat;
    private  String templatUrl;
    private  boolean loopLable;
    public static String getTemplatName(String name){
        String templat = Arrays.asList(MeetingEnums.values())
                .stream()
                .filter(e -> name .equals(e.getName()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }

    public static String getTemplatePath(Integer code){
        String templatePath = Arrays.asList(MeetingEnums.values())
                .stream()
                .filter(e -> code ==e.getCode() )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templatePath;
    }

    public static MeetingEnums getTemplatEnums(int code){
        MeetingEnums meetingEnums = Arrays.asList(MeetingEnums.values())
                .stream()
                .filter(e -> code ==e.getCode() )
                .collect(Collectors.toList())
                .get(0);
        return meetingEnums;
    }

    public static String getUrl(String name){
        PropertiesProxy conf=new PropertiesProxy();
        conf.get("huawei-oss.url");
        String url = Arrays.asList(MeetingEnums.values())
                .stream()
                .filter(e -> name .equals(e.getName()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplatUrl();
        return url;
    }

    public static MeetingEnums getTemplatEnums(String templatePath){
        MeetingEnums meetingEnums = Arrays.asList(MeetingEnums.values())
                .stream()
                .filter(e -> e.getTemplat().equals(templatePath) )
                .collect(Collectors.toList())
                .get(0);
        return meetingEnums;
    }

    public static void main(String[] args) {
        for (MeetingEnums enumObj : MeetingEnums.values()) {
            if (enumObj.isLoopLable()){
                System.out.println(enumObj);
            }

        }
    }


}